<template>
  <div class="not-found">
    <div class="content">
      <el-image :src="notFoundImage" alt="404" class="error-img" fit="cover" />
      <div class="error-info">
        <h2>抱歉，您访问的页面不存在</h2>
        <el-button type="primary" @click="goHome">返回首页</el-button>
      </div>
    </div>
  </div>
</template>

<script setup name="NotFoundPage">
import { useRouter } from 'vue-router';
import notFoundImage from '@/assets/img/404.png';

const router = useRouter();

const goHome = () => {
  router.push('/home');
};
</script>

<style lang="scss" scoped>
.not-found {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f8fa;
  overflow: hidden;

  .content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    .error-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .error-info {
      position: absolute;
      bottom: 15%;
      text-align: center;
      z-index: 1;
      padding: 20px;
      background: rgba(255, 255, 255, 0.9);
      border-radius: 8px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);

      h2 {
        font-size: 24px;
        color: #303133;
        margin-bottom: 20px;
        font-weight: normal;
      }

      .el-button {
        padding: 12px 30px;
        font-size: 16px;
      }
    }
  }
}

// 响应式设计
@media screen and (max-width: 768px) {
  .not-found .content {
    .error-info {
      width: 90%;
      bottom: 10%;

      h2 {
        font-size: 20px;
      }
    }
  }
}
</style>
